<template>
	<view>
		<view class="goods">

			<view class="goods_item" v-for="item in goodsList" :key='item.id' @click="goodsItem(item.id)">
				<image :src="item.img_url"></image>
				<view class="price">
					<text>￥{{item.sell_price}}</text>
					<text>￥{{item.market_price}}</text>
				</view>
				<view>
					{{item.title}}
				</view>
			</view>


		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		methods: {
			//子传父跳转进入商品详情
			goodsItem(id) {
				this.$emit('entergoodsItem', id)
			}
		},
		props: ['goodsList']
	}
</script>

<style lang="less" scoped>
	.goods {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		background: #F5F2F0;
		padding: 0 15rpx;

		.goods_item {
			width: 355rpx;
			margin-top: 10rpx;
			padding: 10rpx;
			box-sizing: border-box;
			background: #fff;

			image {
				width: 80%;
				height: 250rpx;
				display: block;
				margin: 0 auto;
			}

			.price {
				margin: 10rpx 0 15rpx 0;

				text:nth-child(1) {
					color: #b50e03;

				}

				text:nth-child(2) {
					color: #ccc;
					text-decoration: line-through;
					font-size: 30rpx;
					margin-left: 15rpx;
				}
			}

			view:last-of-type {
				font-size: 35rpx;
				// line-height: 35rpx;
			}
		}
	}
</style>
